@extends('admin.layout.index')

@section('content')

<div class="mws-panel grid_8">
  <div class="mws-panel-header">
    <span>
      <i class="icon-table"></i>{{ $title }}</span>
  </div>
  <div class="mws-panel-body no-padding">
    <div id="DataTables_Table_1_wrapper" class="dataTables_wrapper" role="grid">
      <div id="DataTables_Table_1_length" class="dataTables_length">
      <form action="" method="get">
        <label>显示
          <select size="1" name="count" aria-controls="DataTables_Table_1" value="">
            <option value="5" @if(!empty($request['count']) && $request['count'] == 5) selected @endif>5</option>
            <option value="8" @if(!empty($request['count']) && $request['count'] == 8) selected @endif>8</option>
            <option value="15" @if(!empty($request['count']) && $request['count'] == 15) selected @endif>15</option>
            <option value="20" @if(!empty($request['count']) && $request['count'] == 20) selected @endif>20</option></select>条</label>
      </div>
      <div class="dataTables_filter" id="DataTables_Table_1_filter">
        <label>关键字:
          <input type="text" aria-controls="DataTables_Table_1" name="search" value="{{$request['search'] or ''}}">
          <input type="submit" class="btn btn-success btn-xs" value="搜索">
        </label>
      </div>
      </form>
      <table class="mws-datatable-fn mws-table dataTable" id="DataTables_Table_1" aria-describedby="DataTables_Table_1_info">
        <thead>
          <tr role="row">
            <th class="sorting_asc" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Rendering engine: activate to sort column descending" style="width: 141px;">用户ID</th>
            <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending" style="width: 190px;">用户名</th>
            <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1" aria-label="Platform(s): activate to sort column ascending" style="width: 174px;">用户手机</th>
            <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1" aria-label="Platform(s): activate to sort column ascending" style="width: 124px;">用户账号状态</th>
            <th  class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending" style="width: 250px;">操作</th></tr>
        </thead>
        <tbody role="alert" aria-live="polite" aria-relevant="all">
        @foreach($data as $k=>$v)
          <tr class="odd">
            <td class="  sorting_1">{{ $v->uid }}</td>
            <td class=" ">{{ $v->uname }}</td>
            <td class=" ">{{ $v->uphone }}</td>
            <td class=" ">{{ $v->ustatus == 1 ? '启用' : '禁用' }}</td>
            <td class=" " style="width:150px;">
            	　<!-- <a href="javascript:void(0)" onclick="delLink({{$v->uid}})"><button class="btn btn-warning">删除</button></a> -->　
              <a href="javascript:void(0);" onclick="showUser({{$v->uid}})" ><button class="btn btn-success">详细信息</button></a>
            	<a href="/admin/users/{{$v->uid}}/edit"><button class="btn btn-info">状态修改</button></a>
            </td>
          </tr>
         @endforeach
        </tbody>
      </table>
      <script> 
       function showUser($uid){
            $.get('{{url('admin/users/')}}/'+$uid,{},function(data){
                //页面层
                layer.open({
                    type: 1,
                    skin: 'layui-layer-rim', //加上边框
                    area: ['620px', '140px'], //宽高
                    content: data
                });
            });

        }

      </script>
      
       	<div id="page_page" class="">
       {!! $data->appends(['count'=>$count,'search'=>$search])->render() !!}
		</div>
    </div>
  </div>
</div>
@endsection